package com.buric.data.snyc.handler;

import com.gitee.Jmysy.binlog4j.core.BinlogEvent;
import com.gitee.Jmysy.binlog4j.core.IBinlogEventHandler;
import com.gitee.Jmysy.binlog4j.springboot.starter.annotation.BinlogSubscriber;

/**
 * @author: zhou.wei
 * @description
 * @date: 2024/5/29 16:51
 */
@BinlogSubscriber(clientName = "master")
public class UserEventHandler implements IBinlogEventHandler<Object> {
    @Override
    public void onInsert(BinlogEvent<Object> event) {
        System.out.println("插入数据：" + event.getData());
    }

    @Override
    public void onUpdate(BinlogEvent<Object> event) {
        System.out.println("修改数据:" + event.getData());
    }

    @Override
    public void onDelete(BinlogEvent<Object> event) {
        System.out.println("删除数据:" + event.getData());
    }

    @Override
    public boolean isHandle(String database, String table) {
        return database.equals("db_test") && table.equals("sys_user");
    }
}
